#include "Column.h"

Column::Column()
{
}

Column::~Column()
{
}

bool Column::init(){
	GameObject::init();

	isPass = false;

	return true;
}

void Column::addColumnSprite(CCSprite* sprite){
	this->sprite = sprite;
	this->sprite->setPosition(ccp(sprite->boundingBox().size.width/2, sprite->boundingBox().size.height/2));
	addChild(sprite);

	setContentSize(sprite->boundingBox().size);
}

Column* Column::createWithType(int type){
	Column* column = Column::create();
	column->type = type;

	CCSprite* sprite = 0;
	if(type == CT_UP)
		sprite = CCSprite::createWithSpriteFrameName("ColumnUp.png");
	else sprite = CCSprite::createWithSpriteFrameName("ColumnDown.png");
	
	column->addColumnSprite(sprite);
	return column;
}

int Column::getType(){
	return type;
}

void Column::updateCameraPosition(int cameraX){
	sprite->setPositionX(sprite->boundingBox().size.width/2-cameraX);
}